package com.data;

/**
 * Node to be used in Red-Black tree only (sort by y)
 */
public class TreeNode implements Comparable<TreeNode> {
	private double x;
	private double y;

	public double getX() {
		return x;
	}

	public double getY() {
		return y;
	}

	public TreeNode(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public int compareTo(TreeNode o) {
		if (y == o.y && x == o.x) {
			return 0;
		} else if (y < o.y) {
			return -1;
		} else if (y == o.y && x < o.x) {
			return -1;
		} else {
			return 1;
		}
	}
}
